package com.advertising.dao;

import org.springframework.stereotype.Repository;

import com.advertising.model.Evaluate;
import com.advertising.model.Release;
import com.tgyt.common.tools.page.Pagination;
import com.tgyt.framework.dao.hibernate.Finder;
import com.tgyt.framework.dao.hspring.BaseDAO;
@Repository(value="evaluateDAO")
public class EvaluateDAO extends BaseDAO<Evaluate> {
	public Pagination getPageList(Evaluate evaluate, int page, int rows,
			String sort, String order) {
		StringBuffer sb = new StringBuffer("from Evaluate where 1=1");

		if (null != evaluate) {
			 if(null!=evaluate.getContent()&&!"".equals(evaluate.getContent())){
				 sb.append(" and content like '%"+evaluate.getContent()+"%'");
			 }
		 

		}
		//sb.append(" order by  desc");

		if (sort != null && !"".equals(sort)) {
			sb.append(" order by " + sort);
			if (order != null && !"".equals(order)) {
				sb.append(" " + order);
			} else {
				sb.append(" desc");
			}
		}

		return super.getHandler().getPageList(Finder.create(sb.toString()),
				page, rows);
	}
}
